package com.xiege.springboot.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiege.springboot.common.Result;
import com.xiege.springboot.entity.Article;
import com.xiege.springboot.entity.Way;
import com.xiege.springboot.mapper.ArticleMapper;
import com.xiege.springboot.mapper.WayMapper;
import com.xiege.springboot.service.IWayService;
import com.xiege.springboot.service.ThreadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 榭歌
 * @since 2023-03-04
 */
@Service
public class WayServiceImpl extends ServiceImpl<WayMapper, Way> implements IWayService {
    @Autowired
    private WayMapper wayMapper;
    @Autowired
    private ThreadService threadService;
    @Override
    public Way findWayById(Integer wayId) {
        Way way = this.wayMapper.selectById(wayId);
        //启用线程进行查看数更新
        threadService.updateWayViewCount(wayMapper,way);
        return way;
    }
}
